package com.example.demo.model.goods.goods.controler;


import com.example.demo.Results.ResultClass;
import com.example.demo.model.goods.goods.entity.ShopGoodsType;
import com.example.demo.model.goods.goods.service.ShopGoodsTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.servlet.ModelAndView;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author STAHYW
 * @since 2021-10-02
 */
@Api(tags = "后台登录")
@RestController
@RequestMapping("/goods/shopGoodsType")
public class ShopGoodsTypeResource {

    @Autowired
    ShopGoodsTypeService shopGoodsTypeService;





    @ApiOperation(value = "商品分类列表", notes = "商品分类列表")
    @GetMapping("/goodsTypeList")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNo", value = "页码", dataType = "Integer", example = "1"),
            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "Integer", example = "10"),
    })
    public ModelAndView goodsTypeList(Integer pageNo,Integer pageSize){

        return shopGoodsTypeService.goodsTypeList(pageNo,pageSize);
    }

    @PostMapping("/goodsTypeDel")
    @ApiOperation(value = "商品分类列表", notes = "商品分类删除")
    @ApiImplicitParam(name = "id", value = "主健", dataType = "Integer", example = "1")
    public ResultClass goodsTypeDel(Integer id) {

        return shopGoodsTypeService.goodsTypeDel(id);

    }

    @GetMapping("/goodsTypeEdit")
    @ApiOperation(value = "商品分类列表", notes = "商品分类修改")
    @ApiImplicitParam(name = "id", value = "主健", dataType = "Integer", example = "1")
    public ModelAndView goodsTypeEdit(Integer id) {

        return shopGoodsTypeService.goodsTypeEdit(id);


    }

    @PostMapping("/goodsTypeEditDo")
    @ApiOperation(value = "商品类型添加或修改操作", notes = "商品类型添加或修改操作")
    public ResultClass goodsTypeEditDo(ShopGoodsType shopGoodsType) {
        return shopGoodsTypeService.goodsTypeEditDo(shopGoodsType);
    }

}


